import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
// import Person from '../components/person/PersonList.vue'
const Person = () => import(/* webpackChunkName: "person" */ '../components/person/PersonList.vue')
// import FoodMenu from '../components/food/FoodMenuList.vue'
// import FoodTypeList from '../components/food/FoodTypeList.vue'
const FoodMenu = () => import(/* webpackChunkName: "food_type" */ '../components/food/FoodMenuList.vue')
const FoodTypeList = () => import(/* webpackChunkName: "food_type" */ '../components/food/FoodTypeList.vue')

const SyslogList = () => import(/* webpackChunkName: "syslog_type" */ '../components/syslog/SyslogList.vue')

const UserList = () => import(/* webpackChunkName: "user_type" */ '../components/user/UserList.vue')

const RoleList = () => import(/* webpackChunkName: "role_type" */ '../components/role/RoleList.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/person',
        name: 'Person',
        component: Person
      },
      {
        path: '/foodMenu',
        name: 'FoodMenu',
        component: FoodMenu
      },
      {
        path: '/foodType',
        name: 'FoodType',
        component: FoodTypeList
      },
      {
        path: '/syslog',
        name: 'Syslog',
        component: SyslogList
      },
      {
        path: '/user',
        name: 'User',
        component: UserList
      },
      {
        path: '/role',
        name: 'Role',
        component: RoleList
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
